package com.datautil;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DemoDateBaseUtil {
	
		public static Connection getConnection(){
			Connection conn=null;
			try {
				Class.forName("com.mysql.jdbc.Driver");
				String str="jdbc:mysql://localhost:3306/demo?useUnicode=true&characterEncoding=UTF-8";
				conn=DriverManager.getConnection(str, "root", "root123");
			} catch (Exception e) {
				// TODO: handle exception
				e.printStackTrace();
			}
			return conn;
		}
		
		public static void closeConnection(Connection conn) throws SQLException{
		   conn.close();
		}
	}
